"""
Copyright (c) 2023 - present SKbioinfo
"""

from apps.NGS_API.connect import MysqlConnection
from apps.NGS_API.common.db_table_config import *

def get_extraction_info():
    ### SETUP MYSQL connection ###
    db_conn=MysqlConnection()
    ### SQL: sql ###
    extract_base_info_sql = '''
    SELECT 
	 	ext.id,
        ext.extraction_id,
        ext.stock_id,
        ext.sample_id,
        ext.operate_user,
        ext.check_user,
        ext.operate_time,
        ext.create_time,
        ext.modify_time,
        sam.project_id
    FROM {table_one} as ext
    LEFT JOIN {table_two} as sam ON
    ext.sample_id = sam.sample_id
    '''.format(
        table_one=extraction_db["name"],
        table_two=sample_db["name"],
    )
    extract_base_info = db_conn.Query(extract_base_info_sql)
    #close mysql connection
    db_conn.close_conn()
    return extract_base_info
